package com.example.demo2.UserController;

import com.example.demo2.Uservice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping("/freemarker")
public class UserController {

    @Autowired
    private Uservice userService;

    /**
     * 设置数据，返回到freemarker视图
     * @return
     */
    @RequestMapping("/say")
    public ModelAndView say(){
        ModelAndView mav=new ModelAndView();
        mav.addObject("message", "SpringBoot 大爷你好！");
        mav.setViewName("helloWorld");
        return mav;
    }

    @GetMapping("/say2")
    public void say2(){
        userService.aa();
        System.out.println("来啊，一啊，测试啊");
    }

    @GetMapping("/say3")
    public void say3(){
        /*userService.testCache("TMBA","");
        System.out.println("来啊，一啊，测试啊");

        userService.testCache("TMBA",null);
        System.out.println("来啊，一啊，测试啊11");

        userService.testCache(null,null);
        System.out.println("来啊，一啊，测试啊22");*/


        userService.testCache(null,"TEST");
        System.out.println("来啊，一啊，测试啊22");


    }

    @GetMapping("/say4")
    public void say4(){
        userService.getMM();
        System.out.println("getMM来啊，一啊，测试啊");
    }


    @GetMapping("/say5")
    public void say5(){
        userService.clearCscoocuchaBList();
        System.out.println("getMM来啊，一啊，测试啊");
    }


}
